import java.util.ArrayList;
import java.util.LinkedList;

import models.EEntity;
import models.Organization;

import org.junit.Before;
import org.junit.Test;

import antlr.collections.List;

import play.test.Fixtures;
import play.test.UnitTest;

public class foudatest1 extends UnitTest {

	@Before
	public void setup() {
		Fixtures.deleteAll();
	}

	@Test
	public void test() {
		// Create new organization
		new Organization("Intel", "LOL", 0).save();
		new Organization("HP", "LOL", 0).save();
		// Create new entities
		new EEntity("LOL", "cs and engineering department met lol",
				(Organization) Organization.find("byName", "Intel").first())
				.save();
		new EEntity("IET", "Communication and Engineering department",
				(Organization) Organization.find("byName", "Intel").first())
				.save();
		new EEntity("MECHA", "mechatronics and engineering department",
				(Organization) Organization.find("byName", "Intel").first())
				.save();
		new EEntity("MET", "cs and engineering department",
				(Organization) Organization.find("byName", "Intel").first())
				.save();
		// testing
		ArrayList<EEntity> res = (ArrayList) EEntity
				.searchByKeyword("engineering");
		ArrayList<EEntity> res1 = (ArrayList) EEntity.searchByKeyword("IET");
		ArrayList<EEntity> res2 = (ArrayList) EEntity.searchByKeyword("MECHA");
		assertEquals(4, res.size());
		assertEquals(1, res1.size());
		assertEquals(1, res2.size());

	}

}
